<?php
//客户所期待的接口，具体的或抽象的类
class Target{
    public function request(){
        echo '普通请求';
    }
}
//需要适配的类
class Adaptee{
    public function SpecificRequest(){
        echo '特殊请求';
    }
}

//通过在内部包装一个Adaptee对象，把源接口转换成目标接口
class Adapter extends Target{
    private $adaptee;
    public  function __construct(Adaptee $adaptee)
    {
        $this->adaptee = $adaptee;
    }

    public function request()
    {
        $this->adaptee->SpecificRequest();
    }
}
//客户端代码
$target = new Adapter();
$target->request();
